/*******************************************************************************
 * Copyright (c) 2009 EclipseSource and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     EclipseSource - initial API and implementation
 ******************************************************************************/
package org.eclipse.rap.birt.reports;


import org.eclipse.rap.rwt.application.IEntryPoint;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

public class EntryPoint implements IEntryPoint {

  public int createUI() {
    Display display = new Display();
    Shell shell = new Shell( display );
    shell.setLayout( new FillLayout() );
    shell.setSize( new Point( 600, 500 ) );
    shell.setText( "Report Demo Application" );
    
    TabFolder tabFolder = new TabFolder( shell, SWT.TOP );
    TabItem htmlTabItem = new TabItem( tabFolder, SWT.NONE );
    htmlTabItem.setText( "HTML Report" );
    Composite htmlComposite  = new Composite( tabFolder, SWT.NONE );
    new HTMLView().createPartControl( htmlComposite );
    htmlTabItem.setControl( htmlComposite );
    /*
    TabItem pdfTabItem = new TabItem( tabFolder, SWT.NONE );
    pdfTabItem.setText( "PDF Report" );
    Composite pdfComposite  = new Composite( tabFolder, SWT.NONE );
    new PDFView().createPartControl( pdfComposite );
    pdfTabItem.setControl( pdfComposite );
    */
    shell.layout();
    shell.open();
    while( !shell.isDisposed() ) {
      if( !display.readAndDispatch() )
        display.sleep();
    }
    display.dispose();
    
    return 0;
  }
}
